﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace AutoMap
{
    /// <summary>
    /// 序列化进行映射
    /// </summary>
    public class SerializeMapper
    {
        public static TResult? Map<T, TResult>(T entity) where TResult : new()
        {
            var stringobj = JsonSerializer.Serialize(entity);
            return JsonSerializer.Deserialize<TResult>(stringobj);
        }
    }
}
